let React = require('react');

let SearchBox = React.createClass({
  handleClick: function (event) {
    var query = $('#search-box').val();
    if (!$.isBlank(query)) {
      var params = {
        q: query
      };
      location = 'search.html?' + $.param(params);
    }
  },
  render: function () {
    return (
      <div className="search">
        <input id="search-box" placeholder="搜索" type="text"/>
        <input id="search-button" onClick={this.handleClick} type="button" value="搜索"/>
      </div>
    );
  }
});

module.exports = SearchBox;
